package o;

import android.graphics.drawable.Drawable.ConstantState;
import android.graphics.drawable.DrawableContainer;
import android.graphics.drawable.DrawableContainer.DrawableContainerState;
import android.util.Log;
import androidx.annotation.RestrictTo;
import androidx.annotation.RestrictTo.d;
import java.lang.reflect.Method;

@RestrictTo({d.LIBRARY_GROUP})
public class arx {
    private static Method ˊ;
    private static boolean ˋ;

    public static boolean ˎ(DrawableContainer drawableContainer, ConstantState constantState) {
        return ॱ(drawableContainer, constantState);
    }

    private static boolean ॱ(DrawableContainer drawableContainer, ConstantState constantState) {
        if (!ˋ) {
            try {
                ˊ = DrawableContainer.class.getDeclaredMethod("setConstantState", new Class[]{DrawableContainerState.class});
                ˊ.setAccessible(true);
            } catch (NoSuchMethodException e) {
                Log.e("DrawableUtils", "Could not fetch setConstantState(). Oh well.");
            }
            ˋ = true;
        }
        if (ˊ != null) {
            try {
                ˊ.invoke(drawableContainer, new Object[]{constantState});
                return true;
            } catch (Exception e2) {
                Log.e("DrawableUtils", "Could not invoke setConstantState(). Oh well.");
            }
        }
        return false;
    }
}
